﻿
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<style>
    * {
        font-size: 14px;
    }

    #colsWarp > label {
        display: block;
    }

    #colsWarp > div {
        display: inline-block;
        margin-right: 30px;
        width: 110px;
    }
</style>
<div id="colsWarp" style="padding:20px 20px 0;">
    <label id="lbl1">
        选择导出Excel包含的列
        <span style="font-size:8px;cursor:pointer;">
            （
            <label>
                <input id="ckChooseAll" type="checkbox">全选
            </label>
            ）
        </span>
    </label>
</div>
<div style="padding:20px 20px 0;">
    <label>选择导出Excel是否包含筛选条件</label>
    <div class="checkbox">
        <label>
            <input id="ckContainFilter" type="checkbox">包含筛选条件
        </label>
    </div>
</div>

<script>
    var cols = $.request("cols");
    cols = decodeURIComponent(cols);
    cols = JSON.parse(cols);

    $.each(cols, function () {
        $('#colsWarp').append('<div class="checkbox"><label><input type="checkbox" value="' + this.Name + '">' + this.Heading + '</label></div>');
    });

    $('#lbl1 [type=checkbox]').click(function () {
        if (!$('#colsWarp #ckChooseAll').is(':checked')) {
            $('#colsWarp [type=checkbox]').not('#ckChooseAll').prop("checked", false);
        }
        else {
            $('#colsWarp [type=checkbox]').not('#ckChooseAll').prop("checked", true);
        }
    })

    //获取选中的列
    function GetChoosedCols() {
        var restArr = new Array();
        $.each($('#colsWarp input:checked').not('#ckChooseAll'), function () {
            if ($(this).attr('value')) {
                restArr.push($(this).attr('value'));
            }
        });
        return restArr;
    }

    //是否导出筛选条件
    function GetIsContainFilter() {
        return $('#ckContainFilter').is(':checked');
    }

</script>
